package com.tac.controller;

import com.github.pagehelper.PageInfo;
import com.tac.common.result.Result;
import com.tac.pojo.EnergyEfficiency;
import com.tac.service.EnergyEfficiencyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/energyEfficiency")
@Api(tags = "能效预警接口")
@CrossOrigin
public class EnergyEfficiencyController {
    @Autowired
    private EnergyEfficiencyService energyEfficiencyService;


    //查看能效预警
    @ApiOperation("查看能效预警")
    @GetMapping("/getList")
    public Result<PageInfo<EnergyEfficiency>> getList(Integer pageNum, Integer pageSize, String name, String add, Integer status){
        return energyEfficiencyService.getList(pageNum,pageSize,name,add,status);
    }
    //添加能效预警
    @ApiOperation("添加能效预警")
    @PostMapping("/save")
    public Result save(@RequestBody EnergyEfficiency energyEfficiency){
        return energyEfficiencyService.save(energyEfficiency);
    }
    //删除能效预警
    @DeleteMapping("/remove")
    @ApiOperation("删除能效预警")
    public Result remove(@RequestBody List<Integer> ids){
        return energyEfficiencyService.remove(ids);
    }

    //更新能效预警
    @PutMapping("/update")
    @ApiOperation("更新能效预警")
    public Result update(@RequestBody EnergyEfficiency energyEfficiency){
        return energyEfficiencyService.update(energyEfficiency);
    }
}
